home *** CD-ROM | disk | FTP | other *** search
-
- #include <XtcLib.h>
- #include <XtcElements.h>
- #include <XtcMessages.h>
-
- #include <SetJmp.h>
- #include <Time.h>
- #include <Math.h>
- #include <CursorCtl.h>
-
- #include "config.h"
- #include "rc.h"
- #include "MacMud.h"
-
- #undef fopen
- #undef open
-
- // Local Defines
-
- #define DIR_FLAG 0x10
-
- #define WNETICKINTERVAL 8
- #define MAXSTACK 32000L
- #define SPLASHTIME 3 // Number of seconds to display splash sceen
-
- // Global Variables
-
- int gRuntimeMem;
- Boolean gRunning = false;
- Boolean gProgramDone = false;
- THPrint gPrintHdl = NULL;
- short gDefaultFont = 0;
- short gDefaultSize = 12;
- short gDefaultFace = 0;
- short gDefaultJust = UI_JustDefault;
- FSSpec gLastFSSpec;
- Str255 gLastFileName;
- Boolean gCancelOp;
-
- Boolean gLexActive;
- Boolean gSocketActive;
- Boolean gInterpActive;
- Boolean gBackgroundOnly;
-
- NMRec gNMRec;
- Str255 gNotifyStr;
- Boolean gNotifyPending;
-
- short __spin_abort;
-
- static jmp_buf gEnv;
- static THz runtimeZone = NULL;
- static Ptr runtimeHeapPtr = NULL;
-
- extern int num_player;
- extern int lpmain(void);
- extern void read_config(void);
- extern void init_global_configs(void);
- extern pascal Boolean XtcProg(UI_ViewPtr view, UI_Action *action);
- extern void new_player(int new_socket, void *addr, int len);
- extern int game_is_being_shut_down;
- extern Boolean ChangeMudlibDir(long *dirID, short *volRef);
-
- #pragma segment Main
-
- pascal void NMResponseProc(NMRecPtr theNMRec)
- {
- long theA5;
-
- theA5 = SetA5(theNMRec->nmRefCon);
- NMRemove(theNMRec);
- gNotifyPending = false;
- SetA5(theA5);
- }
-
- #pragma segment Main
-
- void AlertUser(short error, short message)
- {
- // Display an alert to inform the user of an error. Message acts
- // as an index into a STR# resource of error messages. If no
- // message is given, i.e. = 0, then use a standard message. If
- // error is not noErr then display it as well.
-
- short itemHit;
- Str255 msg1, msg2;
-
- if (!message) message = eStandardErr;
-
- if (!gBackgroundOnly) {
- GetIndString(msg1, sStdStrings, message);
- InitCursor();
- if (error != noErr) {
- NumToString(error, msg2);
- ParamText(msg1, msg2, "\p", "\p");
- } else ParamText(msg1, "\p", "\p", "\p");
- itemHit = Alert(rUserAlert, NULL);
- } else if (!gNotifyPending) {
- gNotifyPending = true;
- GetIndString(gNotifyStr, sStdStrings, message);
- gNMRec.qType = nmType;
- gNMRec.nmMark = 0;
- gNMRec.nmIcon = 0;
- gNMRec.nmSound = (Handle)-1;
- gNMRec.nmStr = gNotifyStr;
- gNMRec.nmResp = (NMProcPtr)NMResponseProc;
- gNMRec.nmRefCon = SetCurrentA5();
- NMInstall(&gNMRec);
- }
- }
-
- #pragma segment Main
-
- pascal void FatalError(short error, short message)
- {
- EventRecord theEvent;
-
- AlertUser(error, message);
- while (gNotifyPending) {
- if (!UI_HasWaitNextEvent) {
- SystemTask();
- GetNextEvent(everyEvent, &theEvent);
- } else {
- WaitNextEvent(everyEvent, &theEvent, 0x7fffffff, NULL);
- }
- }
- ExitToShell();
- }
-
- #pragma segment Main
-
- void AlertMsg(ConstStr255Param theMsg, ConstStr255Param theParam)
- {
- Boolean gotEvent;
- DialogPtr theAlert;
- EventRecord theEvent;
- DialogRecord alertStorage;
-
- InitCursor();
- ParamText(theMsg, theParam, "\p", "\p");
- theAlert = GetNewDialog(rMsgAlert, &alertStorage, (WindowPtr)(-1));
- ShowWindow(theAlert);
- DrawDialog(theAlert);
-
- gotEvent = false;
- while (!gotEvent) {
- if (!UI_HasWaitNextEvent) {
- SystemTask();
- gotEvent = GetNextEvent(mDownMask + keyDownMask, &theEvent);
- } else {
- gotEvent = WaitNextEvent(mDownMask + keyDownMask, &theEvent, 0, NULL);
- }
- }
- CloseDialog(theAlert);
- }
-
- #pragma segment Initialize
-
- Boolean IsBackroundOnly(void)
- {
- Handle res;
- Boolean backonly;
-
- backonly = false;
- if ((res = GetResource('SIZE',1)) != NULL) {
- backonly = BitTst(*res,5);
- } else if ((res = GetResource('SIZE',0)) != NULL) {
- backonly = BitTst(*res,5);
- } else if ((res = GetResource('SIZE',-1)) != NULL) {
- backonly = BitTst(*res,5);
- }
- if (res) ReleaseResource(res);
- return backonly;
- }
-
- #pragma segment Initialize
-
- void MacInitialize(void)
- {
- Ptr p;
- EventRecord theEvent;
- long total, contig;
- const long *stackBasePtr = (void *)0x908;
-
- // Later we might change our stack requirements, then we can
- // use SetApplLimit to increase stack space at this point,
- // before calling MaxApplZone.
-
- SetApplLimit((Ptr)(*stackBasePtr - MAXSTACK));
- MaxApplZone();
-
- // Initialize the Mac system
-
- MoreMasters();
- MoreMasters();
- MoreMasters();
-
- read_config();
- gNotifyPending = false;
- gBackgroundOnly = IsBackroundOnly();
-
- InitGraf(&qd.thePort);
- if (!gBackgroundOnly) {
- InitFonts();
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs(NULL);
- InitCursor();
- }
-
- FlushEvents(everyEvent, 0);
-
- // This next bit of code is necessary to let MultiFinder pull
- // us to the front. All it needs is a little time.
-
- (void) EventAvail(everyEvent, &theEvent);
- (void) EventAvail(everyEvent, &theEvent);
- (void) EventAvail(everyEvent, &theEvent);
-
- // Lets make sure that the machine has at least 128K ROMs. If it doesn't, die.
-
- if (UI_Mac.machineType < 0)
- FatalError(sStdStrings, eWrongMachine);
-
- if ((ulong)GetApplLimit() - (ulong)ApplicZone() < kMinHeap)
- FatalError(sStdStrings, eSmallSize);
-
- // Next, make sure that enough memory is free for our application to run. It
- // is possible for a situation to arise where the heap may have been of required
- // size, but a large scrap was loaded which left too little memory. To check for
- // this, we call PurgeSpace and compare the result with a value that we have
- // determined as the minimum amount of free memory our application needs at
- // initialization.
-
- PurgeSpace(&total, &contig);
- if (total < kMinSpace)
- FatalError(sStdStrings, eNoMemory);
-
- // The extra benefit to waiting until after the Toolbox Managers have been
- // initialized before checking memory is that we can now give the user an
- // alert to tell him what happened. Although it is possible that the memory
- // situation could be worsened by displaying an alert, MultiFinder would
- // gracefully exit the application with an informative alert if memory
- // became critical. Here we are acting more in a preventative manner to
- // avoid future disaster from low-memory problems.
-
- // Is the desk scrap already in memory?
- if (LoadScrap () == noScrapErr) {
- // Try and initialize it
- ZeroScrap ();
- }
-
- // Initialize our global variables
-
- gProgramDone = false;
-
- // Initialize the Xtc UI library
-
- UI_InitInterface();
-
- // Read and initialize the configuration
-
- init_global_configs();
-
- // Initialize the current printer.
-
- if (!gBackgroundOnly) {
- PrOpen();
- if (PrError() == noErr) {
- if ((gPrintHdl = (THPrint)NewHandle(sizeof(TPrint))) != NULL) {
- PrintDefault(gPrintHdl);
- } else AlertUser(sStdStrings, eNoPrinter);
- PrClose();
- } else AlertUser(sStdStrings, eNoPrinter);
- }
-
- // Register all the view classes we are going to use.
-
- UI_RegisterClass('MAIN', XtcMain);
-
- if (!gBackgroundOnly) {
- UI_RegisterClass('ABOT', XtcAboutBox);
- UI_RegisterClass('SPLS', XtcSplashScreen);
-
- UI_RegisterClass('DEBG', XtcDebug);
- UI_RegisterClass('CONS', XtcConsole);
-
- AddResMenu(GetMenu(M_APPLE), 'DRVR');
- UI_LoadMenuBar(NULL, MAINMENUBAR, true);
- }
- }
-
- #pragma segment StandardFile
-
- Boolean DoStandardGetFile(SFTypeList typeList, short numTypes)
- {
- long response;
-
- if (UI_HasGestalt &&
- Gestalt(gestaltStandardFileAttr, &response) == noErr && response != 0)
- {
- StandardFileReply theReply;
-
- StandardGetFile(NULL, numTypes, typeList, &theReply);
- if (theReply.sfGood) {
- memcpy(&gLastFSSpec,
- &theReply.sfFile, sizeof(gLastFSSpec));
- return true;
- }
- } else {
- Point where;
- SFReply theReply;
-
- SetPt(&where, 80, 80);
- typeList[0] = 'APPL';
- SFGetFile(where, "\p", NULL, numTypes, typeList, NULL, &theReply);
- if (theReply.good) {
- FSSpec theSpec;
-
- theSpec.vRefNum = theReply.vRefNum;
- theSpec.parID = *((ulong *)0x0398);
- memcpy(&theSpec.name, theReply.fName, theReply.fName[0]+1);
- return true;
- }
- }
- return false;
- }
-
- #pragma segment StandardFile
-
- Boolean DoStandardPutFile(ConstStr255Param prompt, ConstStr255Param defaultName)
- {
- long response;
-
- if (UI_HasGestalt &&
- Gestalt(gestaltStandardFileAttr, &response) == noErr && response != 0)
- {
- StandardFileReply theReply;
-
- StandardPutFile(prompt, defaultName, &theReply);
- if (theReply.sfGood) {
- memcpy(&gLastFSSpec, &theReply.sfFile, sizeof(gLastFSSpec));
- return true;
- }
- } else {
- Point where;
- SFReply theReply;
-
- SetPt(&where, 80, 80);
- SFPutFile(where, prompt, defaultName, NULL, &theReply);
- if (theReply.good) {
- gLastFSSpec.vRefNum = theReply.vRefNum;
- gLastFSSpec.parID = *((ulong *)0x0398);
- memcpy(&gLastFSSpec.name, theReply.fName, theReply.fName[0]+1);
- return true;
- }
- }
- return false;
- }
-
- #pragma segment StandardFile
-
- static Boolean _sfnewopenflag;
-
- pascal short SF6NewOpenDlgHook(short item, DialogPtr theDialog)
- {
- #pragma unused(theDialog)
-
- const short kNewButton = 11;
- const short kCancelButton = 3;
-
- // If the user clicked on the "New" button we set our
- // _sfnewopenflag flag variable to true and tell the
- // StandardFile Dialog box that the user pressed quit,
- // so we can call SFPutFile in our main program.
-
- if (item == kNewButton) {
- _sfnewopenflag = true;
- return kCancelButton;
- } else return item;
- }
-
- #pragma segment StandardFile
-
- pascal short SF7NewOpenDlgHook(short item, DialogPtr theDialog, Ptr dataPtr)
- {
- #pragma unused(theDialog,dataPtr)
-
- const short kNewButton = 12;
- const short kCancelButton = 2;
-
- // If the user clicked on the "New" button we set our
- // _sfnewopenflag flag variable to true and tell the
- // StandardFile Dialog box that the user pressed quit,
- // so we can call StandardPutFile in our main program.
-
- if (item == kNewButton) {
- _sfnewopenflag = true;
- return kCancelButton;
- } else return item;
- }
-
- #pragma segment StandardFile
-
- short DoStandardNewOpenFile(SFTypeList typeList, short numTypes, short *refNum)
- {
- Point where;
- long response;
-
- _sfnewopenflag = false;
- if (UI_HasGestalt &&
- Gestalt(gestaltStandardFileAttr, &response) == noErr && response != 0)
- {
- StandardFileReply theReply;
-
- SetPt(&where, 0, 0);
- CustomGetFile(NULL, numTypes, typeList, &theReply, 6042,
- where, &SF7NewOpenDlgHook, NULL, NULL, NULL, NULL);
- if (theReply.sfGood) {
- short curFile;
-
- curFile = CurResFile();
- SetResLoad(false);
- *refNum = FSpOpenResFile(&theReply.sfFile, fsRdWrPerm);
- SetResLoad(true);
- if (ResError() != noErr)
- return -1;
- UseResFile(curFile);
- return true;
- } else if (_sfnewopenflag) {
- return 2;
- }
- } else {
- SFReply theReply;
-
- SetPt(&where, 80, 80);
- SFPGetFile(where, "\p", NULL, numTypes, typeList, NULL,
- &theReply, 4000, (ModalFilterProcPtr)&SF6NewOpenDlgHook);
- if (theReply.good) {
- short curFile;
-
- curFile = CurResFile();
- SetResLoad(false);
- *refNum = OpenRFPerm(theReply.fName, theReply.vRefNum, fsRdWrPerm);
- SetResLoad(true);
- if (ResError() != noErr)
- return -1;
- UseResFile(curFile);
- return true;
- } else if (_sfnewopenflag) {
- return 2;
- }
- }
- return false;
- }
-
- #pragma segment Project
-
- void DoCloseAllWindows(void)
- {
- UI_ViewPtr view;
-
- gCancelOp = false;
- for (view = UI_WindowIsView(UI_FrontWindow());
- view && !gCancelOp;
- view = UI_WindowIsView((WindowPtr)((WindowPeek)view)->nextWindow))
- {
- UI_Action closeAction;
- UI_ViewHeaderHdl viewHdl;
-
- viewHdl = ((UI_ViewPeek)view)->viewHdl;
- if ((*viewHdl)->viewClass == 'TEXT')
- {
- /* UI_SendAction(UI_MakeAction(&closeAction),
- UIA_MenuSelect,
- (M_FILE * 0x10000) + M_FILE_CLOSE,
- view, NULL);
- */ }
- }
- }
-
- #pragma segment Main
-
- pascal Boolean XtcMain(UI_ViewPtr view, UI_Action *action)
- {
- switch (action->what)
- {
- case UIA_OpenApp:
- {
- return true;
- }
- case UIA_OpenDoc:
- {
- FInfo fndrInfo;
- FSSpec *theFSS = (FSSpec *)action->code;
-
- FSpGetFInfo(theFSS, &fndrInfo);
- return true;
- }
- case UIA_PrintDoc:
- {
- FInfo fndrInfo;
- FSSpec *theFSS = (FSSpec *)action->code;
-
- FSpGetFInfo(theFSS, &fndrInfo);
- return true;
- }
- case UIA_Quit:
- {
- gProgramDone = true;
- startshutdowngame();
- return true;
- }
- case UIA_InitMenus:
- {
- DisableItem(GetMHandle(M_APPLE), M_APPLE_PREFERENCES);
- DisableItem(GetMHandle(M_EDIT), 0);
- if (gRunning) {
- DisableItem(GetMHandle(M_MISC), M_MISC_STARTUP);
- } else {
- DisableItem(GetMHandle(M_MISC), M_MISC_SHUTDOWN);
- DisableItem(GetMHandle(M_FILE), M_FILE_NEW);
- }
- return true;
- }
- case UIA_MenuSelect:
- {
- switch (HiWord(action->code))
- {
- case M_APPLE:
- {
- switch (LoWord(action->code))
- {
- case M_APPLE_ABOUT:
- {
- UI_ViewPtr about = UI_LoadView(kAboutView);
-
- if (!about) {
- SysBeep(1);
- break;
- }
- UI_OpenView(about);
- break;
- }
- case M_APPLE_PREFERENCES:
- {
- break;
- }
- default:
- {
- Str255 name;
- GrafPtr savePort;
-
- GetPort(&savePort);
- GetItem(GetMHandle(M_APPLE), LoWord(action->code), &name);
- OpenDeskAcc(name);
- SetPort(savePort);
- }
- }
- break;
- }
- case M_FILE:
- {
- switch (LoWord(action->code))
- {
- case M_FILE_NEW:
- {
- if (gProgramDone)
- break;
- if (num_player < MAX_PLAYERS) {
- new_player(0,NULL,0);
- } else {
- SysBeep(1);
- }
- break;
- }
- case M_FILE_QUIT:
- {
- if (gRunning && !game_is_being_shut_down) {
- InitCursor();
- if (!num_player || Alert(rShutdownAlert, NULL) == ALERT_NO) {
- gProgramDone = true;
- startshutdowngame();
- }
- break;
- } else {
- gProgramDone = true;
- }
- break;
- }
- }
- break;
- }
- case M_MISC:
- {
- switch (LoWord(action->code))
- {
- case M_MISC_STARTUP:
- {
- if (!gRunning) {
- HiliteMenu( 0 );
- UI_UpdateMenuBar(view);
- RunMudlib();
- return true;
- } else {
- SysBeep(1);
- }
- break;
- }
- case M_MISC_SHUTDOWN:
- {
- if (gRunning && !game_is_being_shut_down) {
- InitCursor();
- if (!num_player || Alert(rShutdownAlert, NULL) == ALERT_NO) {
- startshutdowngame();
- }
- } else {
- SysBeep(1);
- }
- break;
- }
- case M_MISC_SHOWMSG:
- {
- break;
- }
- }
- break;
- }
- }
- HiliteMenu( 0 );
-
- UI_UpdateMenuBar(view);
- return true;
- }
- }
- return true;
- }
-
- #pragma segment Splash
-
- pascal Boolean XtcSplashScreen(UI_ViewPtr view, UI_Action *action)
- {
- #pragma unused(view,action)
- return true;
- }
-
- #pragma segment Splash
-
- void DoSplashScreen()
- {
- time_t start_time;
- EventRecord theEvent;
- UI_ViewPtr splashview;
-
- if ((splashview = UI_LoadView(kSplashView)) == NULL) {
- ExitToShell();
- }
- UI_OpenView(splashview);
-
- time(&start_time);
- while (difftime(time(NULL), start_time) < SPLASHTIME) {
- if (!UI_HasWaitNextEvent) {
- SystemTask();
- GetNextEvent(0, &theEvent);
- } else {
- WaitNextEvent(0, &theEvent, UI_SleepTime(), NULL);
- }
- }
- UI_DestructView(splashview);
- }
-
- #pragma segment About
-
- pascal Boolean XtcAboutBox(UI_ViewPtr view, UI_Action *action)
- {
- if (action->what == UIA_MouseUp) {
- UI_DestructView(view);
- return true;
- }
- if (action->what == UIA_InitMenus) {
- DisableItem(GetMHandle(M_APPLE), 0);
- DisableItem(GetMHandle(M_FILE), 0);
- DisableItem(GetMHandle(M_EDIT), 0);
- DisableItem(GetMHandle(M_MISC), 0);
- return true;
- }
- if (action->what == UIA_MenuSelect) {
- return true;
- }
- return XtcMain(view, action);
- }
-
- #pragma segment Main
-
- void LPSetBusy(void)
- {
- UI_BusyCursor = true;
- }
-
- #pragma segment Main
-
- void LPClearBusy(void)
- {
- UI_BusyCursor = false;
- SetCursor(&qd.arrow);
- }
-
- #pragma segment Main
-
- void XtcUnloadSeg(void)
- {
- }
-
- #pragma segment Main
-
- void LPEvents(void)
- {
- Boolean gotEvent;
- UI_Action theAction;
- EventRecord theEvent;
-
- if (!UI_HasWaitNextEvent) {
- SystemTask();
- gotEvent = GetNextEvent(everyEvent, &theEvent);
- } else {
- gotEvent = WaitNextEvent(everyEvent, &theEvent, 0, NULL);
- }
- UI_ProcessEvent(&theEvent, &theAction);
- /*
- * Only return true if we had a keydown or autokey and the
- * event was not a menu selection event.
- */
- __spin_abort =
- ((theEvent.what == keyDown || theEvent.what == autoKey) && !(theEvent.modifiers & cmdKey));
- }
-
- #pragma segment Main
-
- void LPRuntimeZone(void)
- {
- if (runtimeHeapPtr)
- SetZone(runtimeZone);
- else DebugStr("\pLPRuntimeZone NULL?");
- }
-
- #pragma segment Main
-
- void LPApplicZone(void)
- {
- SetZone(ApplicZone());
- }
-
- #pragma segment Main
-
- static Boolean InitRuntimeHeap(unsigned long heapSize)
- {
- const short kZoneHeader = 52; // 52 bytes for header
- const short kZoneTrailer = 12; // 12 bytes for trailer
- const short kMPBlockHeader = 8; // 8 bytes for Master Pointer block hdr
- const short kInitialMstrPtrs = 2; // 2 master pointers created initially
- const short kSlop = 20; // bytes of slop (just in case)
- const short kZoneOverhead = kZoneHeader + kZoneTrailer + kMPBlockHeader + 4 * kInitialMstrPtrs + kSlop;// how large the zone overhead is
-
- SetZone(ApplicZone());
- if (heapSize) {
- runtimeHeapPtr = NewPtr(((heapSize + 7)&~7) + kZoneOverhead);
- if (runtimeHeapPtr == NULL) // can't allocate space for our heap
- return false;
- InitZone(NULL, kInitialMstrPtrs,
- runtimeHeapPtr + GetPtrSize(runtimeHeapPtr), runtimeHeapPtr);
- runtimeZone = GetZone();
- SetZone(ApplicZone());
- } else if (runtimeHeapPtr) {
- DisposPtr(runtimeHeapPtr);
- runtimeHeapPtr = NULL;
- runtimeZone = NULL;
- }
- return true;
- }
-
- #pragma segmetn Main
-
- Boolean ParseDirName(char *path, long *dirID, short *volRef)
- {
- CInfoPBRec pb;
- Boolean dirOK;
-
- c2pstr(path);
- pb.hFileInfo.ioCompletion = NULL;
- pb.hFileInfo.ioNamePtr = path;
- pb.hFileInfo.ioVRefNum = 0;
- pb.hFileInfo.ioDirID = 0;
- pb.hFileInfo.ioResult = noErr;
- pb.hFileInfo.ioFDirIndex = 0;
- dirOK = (PBGetCatInfo(&pb, false) == noErr && (pb.hFileInfo.ioFlAttrib & DIR_FLAG));
- p2cstr(path);
- if (dirOK) {
- *dirID = pb.hFileInfo.ioDirID;
- *volRef = pb.hFileInfo.ioVRefNum;
- }
- return dirOK;
- }
-
- #pragma segment Main
-
- Boolean RunMudlib(void)
- {
- extern long gMudLibDirID;
- extern short gMudLibVolRef;
-
- if (!InitRuntimeHeap(gRuntimeMem)) {
- // failed to allocate runtime heap
- AlertUser(sStdStrings, eNoMemory);
- return false;
- }
- gMudLibDirID = fsRtDirID;
- gMudLibVolRef = 0;
- if (ParseDirName(MUD_LIB, &gMudLibDirID, &gMudLibVolRef) == NULL) {
- if (!gBackgroundOnly) {
- if (!ChangeMudlibDir(&gMudLibDirID, &gMudLibVolRef))
- return false;
- } else {
- return false;
- }
- }
- gRunning = true;
- if (setjmp(gEnv) == 0) {
- lpmain();
- } else {
- CloseConsole();
- }
- gRunning = false;
- return true;
- }
-
- #pragma segment Main
-
- void LPExit(int code)
- {
- if (code != 0) forceshutdowngame();
- InitRuntimeHeap(0);
- longjmp(gEnv, 0);
- }
-
- #pragma segment Main
-
- void main(void)
- {
- extern sock_init();
- extern sock_close_all();
-
- // Unload data segment: note that _DataInit must not be in Main!
- UnloadSeg((ProcPtr) _DataInit);
-
- MacInitialize();
-
- if (!gBackgroundOnly) {
- SetCursor(*GetCursor(watchCursor));
- // Show our splash screen.
- DoSplashScreen();
- }
-
- UnloadSeg((ProcPtr) MacInitialize);
-
- if (!gBackgroundOnly) {
- UnloadSeg((ProcPtr) XtcSplashScreen);
- SetCursor(&qd.arrow);
- }
-
- sock_init();
-
- if (gBackgroundOnly || AUTO_RESTART) {
- while (RunMudlib()) ;
- AlertUser(rUserAlert, eFailedToStart);
- } else {
- while (gRunning || !gProgramDone) {
- LPEvents();
- XtcUnloadSeg();
- }
- }
- while (gNotifyPending) {
- LPEvents();
- XtcUnloadSeg();
- }
-
- sock_close_all();
- }
-